from .load_by_huggingface import load_dataset_by_huggingface
from .load_by_scripting import load_dataset_by_scripting


def load_dataset(*args, **kwargs):
    exceptions = []

    try:
        fs, *args = args
        return load_dataset_by_scripting(fs, *args, **kwargs)
    except Exception as err:
        exceptions.append(err)

    try:
        return load_dataset_by_huggingface(*args, **kwargs)
    except Exception as err:
        exceptions.append(err)

    raise ExceptionGroup(f"Failed to load dataset!", exceptions)
